//
//  HLRtcEvaluateRequest.m
//  YueYue
//
//  Created by hulu001 on 2023/8/22.
//

#import "HLRtcEvaluateRequest.h"

@implementation HLRtcEvaluateRequest
{
    NSDictionary *_params;
    HLRtcEvaluateType _type;
}

- (id)initWithType:(HLRtcEvaluateType)type params:(NSDictionary *)params
{
    self = [super init];
    
    if (self) {
        _type = type;
        _params = params;
    }
    
    return self;
}



- (NSString *)requestUrl
{
    switch (_type) {
        case HLRtcEvaluateTypeSave:
            return @"/evaluate/save";
            break;
        case HLRtcEvaluateTypeLabel:
            return @"/home/label/config/list";
            break;
        case HLRtcEvaluateTypeFirst:
            return @"/is_first_video_call";
            break;
    }
    
}

- (YTKRequestMethod)requestMethod
{
    if (_type == HLRtcEvaluateTypeSave){
        return YTKRequestMethodPOST;
    }
    return YTKRequestMethodGET;
}

- (id)requestArgument
{
    if (_params){
        return _params;
    } else {
        return @{};
    }
}

- (NSArray <HLRtcEvaluateLabelModel *> *)labelList
{
    NSArray *lists = @[];
    
    NSArray *records = [self.result valueForKey:@"data"];
    if (records.count > 0) {
       lists = [HLRtcEvaluateLabelModel mj_objectArrayWithKeyValuesArray:records];
    }
    
    return lists;
}

- (NSString *)isFirst
{
    return [self.result valueForKey:@"data"];
}
@end
